//
//  LZPesonHeardView.m
//  DoctorFAQs
//
//  Created by langZai on 2017/2/9.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "LZPesonHeardView.h"

@implementation LZPesonHeardView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        // 背景图片
        UIImageView *backImageView = [[UIImageView alloc] init];
        backImageView.userInteractionEnabled = YES;
//        backImageView.image = [UIImage imageNamed:@"center_bg"];
        backImageView.backgroundColor = KHGreenColor;
        [self addSubview:backImageView];
        [backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.size.sizeOffset(CGSizeMake(SCREEN_Width, 120));
//            make.centerX.top.equalTo(self);
            make.height.offset(120*ysIZE);
            make.width.offset(SCREEN_Width);
            make.centerX.equalTo(self);
            make.top.equalTo(self);
            
        }];
        
        // 覆盖透明button
        _clickBtn = [[UIButton alloc] init];
        [_clickBtn setBackgroundColor:[UIColor clearColor]];
        [self addSubview:_clickBtn];
        self.clickBtn = _clickBtn;
        [_clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.offset(120*ysIZE);
            make.width.offset(SCREEN_Width);
            make.centerX.equalTo(self);
            make.top.equalTo(self);
        }];
        
        // 头像
        _iconImageView = [[UIImageView alloc] init];
        _iconImageView.layer.cornerRadius = 35*xsIZE;
//        _iconImageView.clipsToBounds = YES;
        _iconImageView.layer.masksToBounds  = YES;
        _iconImageView.image = [UIImage imageNamed:@"icon_center_tx"];
        [backImageView addSubview:_iconImageView];
        [_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(70*xsIZE);
            make.height.offset(70*xsIZE);
            make.centerX.equalTo(backImageView);
            make.top.equalTo(backImageView).offset(20*ysIZE);
        }];
        
        // 名字
        _nameLabel = [[UILabel alloc] init];
        [backImageView addSubview:_nameLabel];
        _nameLabel.font = FONT(18);
        _nameLabel.textColor = [UIColor whiteColor];
//        _nameLabel.text = @"上官小黑";
        _nameLabel.textAlignment = NSTextAlignmentLeft;
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.iconImageView.mas_bottom).offset(5*ysIZE);
            make.centerX.equalTo(_iconImageView);
        }];
    }
    return self;
}

@end
